<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta name="referrer" content="no-referrer"/>
    <link href="favicon.ico" rel="shortcut icon" />
    <link th:href="@{/css/bootstrap-3.3.7-dist/css/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/css/bootstrap-3.3.7-dist/css/bootstrap-theme.css}" rel="stylesheet">
    <link th:href="@{/css/login.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/js/jquery-3.0.0.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery-3.0.0.min.js}"></script>
    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<!--    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/npm.js}"></script>-->
</head>
<body class="body" style="background-color: #F2F2F2">
<div class="modal-dialog" style="margin-top: 10%;">
    <form class="form" method="post" action="#" th:action="@{/admin/login}">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title text-center" id="myModalLabel">个人博客登录</h4>
            </div>
            <div class="modal-body" id = "model-body">
                <div class="form-group">
                    <input type="text" id="username" name="username" class="form-control" placeholder="用户名" autocomplete="off">
                </div>
                <div class="form-group">
                    <input type="password" id="password" name="password" class="form-control" placeholder="密码" autocomplete="off">
                </div>
            </div>
            <div class="modal-footer">
                <div class="form-group">
                    <button type="submit" class="btn btn-primary form-control">登录</button>
                </div>
                <div class="form-group">
                    <button type="button" class="btn btn-default form-control">注册</button>
                </div>
                <div class="form-group message" style="text-align: center"></div>
                <div class="form-group" th:unless="${#strings.isEmpty(message)}" th:text="${message}" style="text-align: center">用户名和密码错误</div>

            </div>
        </div><!-- /.modal-content -->
    </form>
</div><!-- /.modal -->

<script type="text/javascript">
    var username = $("#username")
    var password = $("#password")
    $(document).ready(function () {
        $(".form").submit(function () {
            if (login()){
                return true
            }else {
                return false
            }
        })
    })
    function login() {
        if (username.val() == "" && password.val() == ""){
            window.alert("用户名和密码不为空")
            return false
        }
        if(username.val() == ""){
            window.alert("用户名不为空")
            return false
        }
        if(password.val() == "") {
            window.alert("密码不为空")
            return false
        }
        return true
    }


</script>

<script type="text/javascript">
    $("#newBlog-container").load(/*[[@{/footer/newBlog}]]*/"/footer/newBlog")
</script>
</body>
</html>



